import { computed, reactive, ref } from "vue";

export default function(){
    console.log(111);

    const mytext = ref('');
    const data = reactive({
        datalist:[]
    });

    const showlist = computed(()=>{
        console.log(data.datalist.filter((data)=>data));
        return data.datalist.filter((data)=>data.includes(mytext.value));
    });

    // 模拟一下真实开发场景, 一秒后拿到数据
    setTimeout(() => {
        data.datalist = ["11111", "22222", "33333", "44444", "55555"];
    }, 1000);

    return {
        mytext,
        data,
        showlist
    }
}